package com.example.springboot.mapper;

import com.example.springboot.entity.Like;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LikeMapper {
    @Select("select id,like_id as likeId,liked_id as likedId,update_time as updateTime,is_like as isLike   from user_likes where like_id = #{likeId} and liked_id = #{likedId}")
    Like isEmpty (Like like);
    @Insert("insert into user_likes(like_id,liked_id,is_like) values(#{likeId},#{likedId},#{isLike})")
    void insertLike(Like like);
    @Select("update user_likes set is_like = #{isLike} where like_id = #{likeId} and liked_id = #{likedId}")
    void updateLike(Like like);
}
